package com.fyzk.activity.zhifu;

import com.fyzk.activity.lottery.basketball.JCLQFragmentActivityI;
import com.fyzk.activity.lottery.basketball.JCLQPayActivity;
import com.fyzk.activity.lottery.jc.football.guoguan.JC_GuoGuanDialog;
import com.fyzk.activity.lottery.jc.football.guoguan.JC_GuoGuanInfor;
import com.fyzk.adapter.JCLQSFCPayAdapter;
import com.fyzk.model.JCLQMatchData;
import com.fyzk.model.JCLQMatchData.SPInfo;
import com.fyzk.utils.IntentParamUtils;

import java.util.List;

/** 竞彩篮球胜负投注类 */
public class JCLQSFCPayActivity extends JCLQPayActivity {

	@Override
	protected void setAdapter() {
		isDanguan = getIntent().getBooleanExtra(IntentParamUtils.TYPE_GUOGUAN, false);
		adapter = new JCLQSFCPayAdapter(this, isDanguan,
                jcInfors, handler,this);
		listView.setAdapter(adapter);
	}

	
	@Override
	protected String getContent() {
		/**
		 * 竞彩注码基本格式
		 * 300612001-20140101001(0,1,3)|20140101002(0,1,3)|20140101003(0,1,3)^
		 * 3006：彩种编号 1：单复式 2001:2串1 20140101001:场次编号 (0,1,3)：投注内容
		 * 
		 * 竞彩混合注码格式
		 * 300512001-20140330302*3004(2)|20140330302*3001(1,3)|20140330307
		 * *3001(0)^ 与非混合的区别是，赛事编号后面多了一个玩法字段。
		 * 
		 * 胆拖
		 * 300622001-20140101001(0,1,3)$20140101002(0,1,3)|20140101003(0,1,3)^
		 * $前面为胆码 $后面为托码
		 **/
		String[] zhumas = {"01", "02", "03", "04", "05", "06", "11", "12",
				"13", "14", "15", "16" };
		List<String> chuans = JC_GuoGuanInfor.getChuanIds(
				JC_GuoGuanDialog.result, isDanguan);
		String content = "";
		for (int i = 0; i < chuans.size(); i++) {
			content += lotteryId + "" + wanFa + chuans.get(i) + "-";// 301012001-
			String n = "";
			for (int j = 0; j < JCLQFragmentActivityI.matchs.size(); j++) {
				JCLQMatchData info = JCLQFragmentActivityI.matchs.get(j);
				StringBuffer danChang = new StringBuffer();
				if (info.clickNum>0) {
					danChang.append(info.getMatchNum());
					danChang.append("(");
					List<SPInfo> infos = info.plInfos;
					for (JCLQMatchData.SPInfo info1 : infos) {
						int index = infos.indexOf(info1);
						if (info1.isSel) {
							danChang.append(zhumas[index]);
							danChang.append(",");
						}
					}
					danChang.deleteCharAt(danChang.length() - 1);
					danChang.append(")");
					if (!danChang.equals("")) {
						n += danChang + "|";
					}
				}
			}
			if (!n.equals("")) {
				n = n.substring(0, n.length() - 1);
				n += "^";
			}
			content += n + "!";
		}
		if (!content.equals("")) {
			content = content.substring(0, content.length() - 1);
		}
		return content;
	}

}
